import request from '@/utils/request'

// 查询货源方列表
export function listCompany(query) {
  return request({
    url: '/tws/company/list',
    method: 'get',
    params: query
  })
}

// 所有货源方
export function listCompanyAll(query) {
  return request({
    url: '/tws/company/listAll',
    method: 'get',
    params: query
  })
}

// 审核计数
export function getCertNum() {
  return request({
    url: '/tws/company/getCertNum',
    method: 'get'
  })
}

// 查询货源方详细
export function getCompany(id) {
  return request({
    url: '/tws/company/' + id,
    method: 'get'
  })
}

// 查询货源方
export function getCompanyByUserId(userId) {
  return request({
    url: '/tws/company/getCompanyByUserId/' + userId,
    method: 'get'
  })
}

// 新增货源方
export function addCompany(data) {
  return request({
    url: '/tws/company',
    method: 'post',
    data: data
  })
}

// 修改货源方
export function updateCompany(data) {
  return request({
    url: '/tws/company',
    method: 'put',
    data: data
  })
}

// 货源方审核
export function cert(data) {
  return request({
    url: '/tws/company/cert',
    method: 'post',
    data: data
  })
}

// 货源方禁/启用
export function stateChange(data) {
  return request({
    url: '/tws/company/stateChange',
    method: 'post',
    data: data
  })
}

// 删除货源方
export function delCompany(id) {
  return request({
    url: '/tws/company/' + id,
    method: 'delete'
  })
}
